#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
#include<assert.h>
#include<stdbool.h>
#include<time.h>


#define HPInitCapacity 4

typedef int HPDataType;
typedef struct Heap
{
	HPDataType* a;
	int size;
	int capacity;
}HP;

void Swap(HPDataType* a1, HPDataType* a2);
void HeapInit(HP* php);
void HeapInitArr(HP* php, HPDataType*a,int n);
void HeapDestroy(HP* php);
void HeapPush(HP* php, HPDataType x);
void HeapPop(HP* php);
void AdjustUpBigHeap(HPDataType* a, int child);
void AdjustUpSmallHeap(HPDataType* a, int child);
void AdjustDownBigHeap(HPDataType* a, int size, int parent);
void AdjustDownSmallHeap(HPDataType* a, int size, int parent);
bool HeapEmpty(HP* php);
HPDataType HeapTop(HP* php);
int HeapSize(HP* php);
void HeapSort(int* a, int n);